﻿using FBEntities.FBObjects;
using Newtonsoft.Json.Linq;
using XDAFacebook;
using XFControls.Utils;

namespace FBEntities.FBConnections
{
    public interface IFBConnection
    {
        WebDownloaderWrapper Parse(string senderId);
    }

    public class FBConnection : IFBConnection
    {
        public bool Parsed;

        public FBPaging paging;
        internal string type = "";
        private string _senderId;

        #region IFBConnection Members

        public WebDownloaderWrapper Parse(string senderId)
        {
            _senderId = senderId;
            return new WebDownloaderWrapper("https://graph." + Settings.Domain + ".com/" + senderId + "/" + type + "?" + FBParseUtilities.authKey);
        }

        #endregion

        public void Parse(JObject o)
        {
            if (o == null) return;

            FBParseUtilities.Parse(o, this);
            Parsed = true;
        }
    }
}